package com.test.proxy.jdk;

import java.lang.reflect.Proxy;

public class Main {
    public static void main(String[] args) {
        //生成一个代理对象
        SmsService smsService = (SmsService) Proxy.newProxyInstance(
                        SmsService.class.getClassLoader(),//目标类加载器
                        new Class[]{SmsService.class},//代理需要实现的接口
                        //传入目标对象
                        new MyInvocationHandler(new SmsServiceImpl()));
        smsService.show("发送");
    }
}
